package com.backend.struts;

import java.util.ArrayList;
import java.util.List;

public class GlobalDefine {

    public enum PRODUCT_STATUS {
        deleted, insale, saled, saling,aftersale
    }

    public enum GENRE_TYPE {
        phone("二手手机"), beauty_makeup("美妆"), car("二手车"), culture("文化"), digital("数码"),
        dress("服饰"), ele("家电"), game("虚拟物品"), daily("日用品");
        private String genre_name;

        GENRE_TYPE(String genre_name) {
            this.genre_name = genre_name;
        }

        public String getGenreName() {
            return this.genre_name;
        }

        public static GENRE_TYPE getObject(String genre_name) {
            for (GENRE_TYPE genre_type : GENRE_TYPE.values()) {
                if (genre_type.name().equals(genre_name)) {
                    return genre_type;
                }
            }
            return null;
        }
    }

    public enum SORT_CONDITION {
        recommend("推荐"), price_desc("价格从高到低"), price_asc("价格从低到高"), distance_near("离我最近");
        private String cName;

        public String getCName() {
            return this.cName;
        }

        private SORT_CONDITION(String name) {
            this.cName = name;
        }

        public static SORT_CONDITION getObjectByName(String name) {
            for (SORT_CONDITION condition : SORT_CONDITION.values()) {
                if (condition.name().equals(name)) {
                    return condition;
                }
            }
            return null;
        }
    }
}
